package com.whw.fy.mapper;

import com.whw.fy.entity.Schedule;
import java.util.Date;import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface ScheduleMapper {
    int deleteByPrimaryKey(Integer scheduleId);

    int insert(Schedule record);

    int insertSelective(Schedule record);

    Schedule selectByPrimaryKey(Integer scheduleId);

    int updateByPrimaryKeySelective(Schedule record);

    int updateByPrimaryKey(Schedule record);

    int updateBatch(List<Schedule> list);

    int updateBatchSelective(List<Schedule> list);

    int batchInsert(@Param("list") List<Schedule> list);

    List<Schedule> selectALL();

    List<Schedule> selectByTeacherIdAndTimeDay(@Param("teacherId") Integer teacherId, @Param("timeDay") Date timeDay);

    List<Schedule> selectByClassIdAndTimeDay(@Param("classId") Integer classId, @Param("timeDay") Date timeDay);

    Schedule selectByClassIdAndTimeSkcdAndTimeSkjc(@Param("classId") Integer classId, @Param("timeSkcd") Integer timeSkcd, @Param("timeSkjc") Integer timeSkjc);

    //当天所在周的所有排课
    List<Schedule> selectByTeacherIdAndTimeDayNow(@Param("teacherId") Integer teacherId);

    List<Schedule> selectAllByRoomIdAndTimeDay(@Param("roomId")Integer roomId,@Param("timeDay")Date timeDay);



    //当天所在月的所有已经上完的排课
    List<Schedule> selectByTeacherIdAndScheduleStatusAndTimeDayNowInMonth(@Param("teacherId") Integer teacherId);

    //根据teacherId和classId当天所在月的所有已经上完的排课统计上课时长
    int sumTimeSkjcByTeacherIdAndClassIdAndScheduleStatusAndScheduleWorkOvertimeAndTimeDayNowInMonth(@Param("teacherId")Integer teacherId,@Param("classId")Integer classId,@Param("scheduleWorkOvertime")Integer scheduleWorkOvertime);


    //当天所在周的所有排课
    List<Schedule> selectByTeacherIdAndTimeDayNowAndClassId(@Param("teacherId") Integer teacherId, @Param("classId") Integer classId);

    //当天所在周该班级的所有排课
    List<Schedule> selectByClassIdAndTimeDayNowInWeek(@Param("classId") Integer classId);

    //查询当天及当天后的记录
    List<Schedule> selectByClassIdAndTimeDayZuiJInZhiHou(@Param("classId") Integer classId, @Param("timeDay") Date timeDay);

    //查询当天及当天前的记录
    List<Schedule> selectByClassIdAndTimeDayZuiJInZhiQian(@Param("classId") Integer classId, @Param("timeDay") Date timeDay);

    List<Schedule> selectByClassId(@Param("classId") Integer classId);

    List<Schedule> selectByTimeDay(@Param("timeDay") Date timeDay);

    List<Schedule> selectByClassIdAndNowOrderByTimeSkcdAsc(@Param("classId") Integer classId);

    int updateScheduleStatusByScheduleId(@Param("updatedScheduleStatus") Integer updatedScheduleStatus, @Param("scheduleId") Integer scheduleId);

    int updateScheduleStatusAndScheduleCompletionTimesByScheduleId(@Param("updatedScheduleStatus") Integer updatedScheduleStatus, @Param("updatedScheduleCompletionTimes") Integer updatedScheduleCompletionTimes, @Param("scheduleId") Integer scheduleId);
}